/**
 * 
 */
package com.huarui.desktop.service.impl;

import java.util.List;

import org.ewaf.framework.model.PagingInfo;

import com.huarui.desktop.dao.DesktopDao;
import com.huarui.desktop.dao.DesktopMenuDao;
import com.huarui.desktop.model.Desktop;
import com.huarui.desktop.model.DesktopMenu;
import com.huarui.desktop.service.DesktopInfoService;

/**
 * @author sunpeng
 * 
 */
public class DesktopInfoServiceImpl implements DesktopInfoService {

	private DesktopDao desktopDao;
    public DesktopMenuDao desktopMenuDao;
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.huarui.desktop.service.DesktopInfoService#queryDesktopInfos(org.ewaf
	 * .framework.model.PagingInfo)
	 */
	@Override
	public void queryDesktopInfos(PagingInfo<Desktop, Desktop> paginInfo) {
		List<Desktop> items = this.desktopDao.selectDesktops(paginInfo.getCondition(), paginInfo.getSummary());
		int total = this.desktopDao.selectDesktopsCount(paginInfo.getCondition());
		paginInfo.setItems(items);
		paginInfo.setTotal(total);

	}

	public List<DesktopMenu> querySubMenus(Integer desktopId,Integer menuId){
		return this.desktopMenuDao.selectSubMenus(desktopId, menuId);
		
	}
	
	public void setDesktopDao(DesktopDao desktopDao) {
		this.desktopDao = desktopDao;
	}
	
	

	public void setDesktopMenuDao(DesktopMenuDao desktopMenuDao) {
		this.desktopMenuDao = desktopMenuDao;
	}

	public void addDesktop(Desktop desktop) {

		this.desktopDao.create(desktop);
	}

	public void modifyDesktop(Desktop desktop) {
		this.desktopDao.update(desktop);

	}

}
